package by.dkusch.aircompany.services;

import java.util.List;

import javax.persistence.metamodel.SingularAttribute;

import org.springframework.transaction.annotation.Transactional;

import by.dkusch.aircompany.model.tables.base.BaseEntity;

public interface AbstractService<ID, Entity extends BaseEntity<ID>> {

	@Transactional
	Entity get(ID id);

	@Transactional
	void saveOrUpdate(Entity entity);

	@Transactional
	void delete(Entity entity);

	@Transactional
	void deleteAll();

	@Transactional
	void changeArchiveFL(boolean arcFL, Entity ent);

	@Transactional
	void saveList(List<Entity> records);

	public List<Entity> getAllByFieldRestriction(
			final SingularAttribute<? super Entity, ?> attribute, final Object value);

}
